1. Field of the Invention
This invention is in the field of displaying colors on computer systems, and in particular to colormapping in windowing computer systems.
Portions of the disclosure of this patent document may contain material that is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure as it appears in the Patent and Trademark Office file or records, but otherwise reserves all copyright rights whatsoever. Sun Microsystems, Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International in the United States and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc.
2. Background
Many computer systems have a color display for displaying color images and data. Some applications display color images that are limited to 256 different colors. This is accomplished by having a xe2x80x9ccolormapxe2x80x9d that includes the description of 256 different colors and indexes to each color description. Each pixel to be displayed on the display has an associated index value. The index is used to find the color of the pixel by looking it up in the colormap.
A problem with this system occurs when more than one image or window are displayed on the display. Each image or window may have its own associated colormap, and only a limited number of colormaps are available at any one time. If the number of color maps is xe2x80x9cnxe2x80x9d color maps, but there are n+1 images requiring n+1 colormaps, a problem arises. For purposes of this discussion, consider the situation where there are two images requiring two colormaps, but only one colormap can be available at one time. Typically, it is the colormap of the xe2x80x9ctopmostxe2x80x9d image or window that is used as the colormap for both images on the display. Thus, the topmost image will have correct colors, but the other image will look incorrect, because it is using an incorrect colormap. This improper mapping of the color of an image to an incorrect color map is known as colormap xe2x80x9cflashxe2x80x9d. Each time the other image or window is made the topmost window, its colormap is made the colormap for the entire display. The previous topmost image that previously looked correct now looks incorrect because it is displayed with an incorrect colormap. The problems associated with colormaps can be understood by reviewing current colormap techniques.
Colormaps
The colormap is an indexed look-up table comprising rows of color cells and columns corresponding to fields within each cell, wherein each color cell represents a unique color for the colormap. Each cell contains digital color values representing a particular color such as red, green and blue, and generally, the number of cells in a colormap represents the number of individual colors provided by the colormap.
Typically only one colormap is utilized by the computer system hardware, and each application running in a window requests a different colormap to be loaded into the computer""s colormap hardware for use. Thereafter, the colors displayed on the display screen are defined by the loaded colormap. One way for a window to have its colormap loaded is when the window is on top or is in the foreground in the windowing system and receives all user input. Where the number of colormaps requested by one or more other windows for display exceeds the number of colormaps which the underlying hardware can support, these other windows flash with incorrect colors. For example, where the hardware supports one 256 entry colormap then at most 256 unique colors can be displayed at a time. Another window whose colormap is not loaded displays unexpected colors. Further, if an application writes data to a window with a different colormap than that loaded in the hardware, then certain area within the screen appear to suddenly flash to different colors. When the colormaps between two windows differ significantly, then flashing is very prominent.
Further, many older applications were written using 8-bit color-mapped graphics wherein each pixel in a display frame buffer has a corresponding index to a colormap table. However, modern graphics systems often provide only 24-bit, or higher, true-color graphics support and cannot normally support the old 8-bit color-mapped applications. The problem is to support such programs with reasonable performance without 8-bit colormap hardware.
There is therefore a need for a method of colormapping in a windowing graphics system which eliminates colormap flash. There is also a need for such a method to support 8-bit color color-mapped applications in 24-bit graphics systems without use of 8-bit colormap hardware and with minimal performance loss.
The present invention provides a method of displaying color values in a plurality of images or windows on a display in a computer graphics system. The graphics system comprises a primary frame buffer for pixel values to be displayed in said windows, and a plurality of colormap tables corresponding to the windows for providing color values to be displayed in the windows. The method comprises the steps of: providing a frame buffer in software (in one embodiment a pseudo frame buffer) to store source pixel values for display in the windows, wherein each source pixel value selects a color value within a colormap table; and for each source pixel value in the pseudo frame buffer, performing steps including: (1) identifying the corresponding image, (2) selecting a colormap table corresponding to the identified image, (3) using the source pixel value to select a color value from the selected colormap table, and (4) storing the selected color value as a pixel value in the primary frame buffer to be displayed.
In another embodiment, the method of the present invention comprises the steps of: providing a pseudo frame buffer for said images to store source pixel values for display in the images; providing an image identifier for each source pixel value in the pseudo frame buffer, wherein the image identifier selects a colormap table corresponding to the image and the source pixel value selects a color value within the selected colormap table; and for each source pixel value in the pseudo frame buffer, performing steps including: (1) determining the image identifier corresponding to the source pixel value, (2) selecting a colormap table corresponding to the image identifier, (3) using the source pixel value to select a color value from the selected colormap table, and (4) storing the selected color value as a pixel value in the primary frame buffer for display.
In another aspect the present invention provides a subsystem for displaying color values for different images on a display device in a graphics system, wherein the graphics system includes a primary frame buffer for pixel values to be displayed in said images, and a plurality of colormap tables corresponding to the images for providing color values to be displayed in said images. The subsystem comprises: (a) a pseudo frame buffer for applications to store source pixel values for display in corresponding images, wherein each source pixel value includes an index to a color value in colormap table; and (b) a controller for colormapping each source pixel value in the pseudo frame buffer, including: (1) means for identifying the image corresponding to the source pixel value, (2) a colormap selector for selecting a colormap table corresponding to the identified image, (3) a color selector for selecting a color value from the selected colormap table using the source pixel value, and storing the selected color value as a pixel value in the primary frame buffer to be displayed.
In another embodiment, the subsystem comprises: (a) a pseudo frame buffer for said applications to store source pixel values for display in said corresponding images; (b) means for providing an image identifier for each source pixel value in the pseudo frame buffer, wherein the image identifier selects a colormap table corresponding to the image and the source pixel value selects a color value within the selected colormap table; and (c) a controller for colormapping each source pixel value in the pseudo frame buffer, including: (1) means for determining the image identifier corresponding to the source pixel value, (2) a colormap selector for selecting a colormap table corresponding to the image identifier, (3) a color selector for selecting a color value from the selected colormap table using the source pixel value, and storing the selected color value as a pixel value in the primary frame buffer for display.
As such, according to the present invention, the pixel values to be displayed in an image are first mapped to a colormap table corresponding to the image and then displayed on the display device. Therefore, two or more images on the display device can utilize two or more different colormap tables for displaying color values in each image, whereby flashing is eliminated. Indeed, there is no apriori limit on the number of different colormaps whose mapped images are displayable simultaneously without flashing. The present invention further provides support for applications using different color-mapping schemes. For example, the present invention provides support for an 8-bit color-mapped applications in a 24-bit graphics system by mapping the pixel values generated by the 8-bit application to the proper colormap table for the image before display.